﻿@using ForumEngine.Models

@model SectionModel

@{
    ViewBag.Title = Model.Name;
}

@Html.Partial("PathPartial", Model.Path)

@if (Model.Forums.Any())
{
    @Html.Partial("SectionListPartial", new List<SectionModel> {Model})
}

@if (Model.Threads.Any())
{
    <div class="threads">
        <div class="title">Threads for: @Model.Name</div>
        <table>
            @foreach (var thread in Model.Threads)
            {
                <tr>
                    <td class="posts">@thread.Posts Posts</td>
                    <td class="icon">&nbsp;</td>
                    <td class="text">
                        <div class="name"><a href="@thread.Url">@thread.Name</a></div>
                        <div class="pages"></div>
                        <div class="started">Started at @thread.Created.ToShortDateString() by @Html.Partial("UserLinkPartial", thread.CreatedBy)</div>
                    </td>
                    <td class="views">@thread.Views Views</td>
                    <td class="last-post">
                        @if (thread.LastAuthor != null)
                        {
                            <div class="title"><a href="@thread.LastPostUrl">Last post</a> from @Html.Partial("UserLinkPartial", thread.LastAuthor)</div>
                            <div class="date">@thread.LastPostTime.ToShortDateString()</div>
                        }
                    </td>
                </tr>
            }
        </table>
    </div>
}

@Html.Partial("PathPartial", Model.Path)
